#ifndef		SERVER_HPP_
# define	SERVER_HPP_

# include	<iostream>
# include	<list>

# include	"Connected.hpp"
# include	"Control.hpp"
# include       "SockInfo.hpp"
# include	"ACommunicator.hpp"

class ServerTcp : public ACommunicator
{
  std::list<Connected *>	Co;
  
  virtual int   TryToWrite(std::list<Buffer *> &writeBuf,
                           int fd);
  virtual int   TryToRead(Buffer &readBuf,
                          int fd);

  virtual int   CheckIsComplete(Connected       &Co,
                                int             fd);
  virtual int TraitementBuf();
  int     CheckCompleteBuf();
  int           Network();
  int           ReadOrWrite();

  int AddToListWrite(int fd,
		     char *buf,
		     int sizeBuf);

  int           NewConnection();
  int           Add_A_Connected();
  int           Remove_A_Connected();

  int   Connection();
  
public:
  ServerTcp(int	port);
  virtual ~ServerTcp();

  int		Run();
};

#endif		/* SERVER_HPP_ */
